Skip to content

Conversation

@Hristo313
Copy link
Contributor

@Hristo313 Hristo313 commented Apr 3, 2025

Remove the step in github pages yml for adding the ig-theme, because we’ll use the import inline css syntax for the styles. The changes will be handled in the CodeGen, so no further modifications are needed here.

@coveralls
Copy link

coveralls commented Apr 3, 2025

Coverage Status

coverage: 70.152%. remained the same
when pulling 695d11b on hhristov/update-vite-config-to-add-static-css-files
into 9e375f9 on master.

import { viteStaticCopy } from 'vite-plugin-static-copy';
import fs from 'fs';

const gridMaterialCssPath = [
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will handle only material light theme and will not handle dark theme as well as all bootstrap, indigo and fluent themes.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Added light or dark color for material bootstrap, indigo and fluent themes.

Comment on lines 7 to 15
const themeColors = ["light", "dark"];
const themeTypes = ["material", "bootstrap", "indigo", "fluent"];
const basePaths = [
"node_modules/igniteui-webcomponents-grids/grids/themes",
"node_modules/@infragistics/igniteui-webcomponents-grids/grids/themes"
];
const themeFiles = themeColors.flatMap(color =>
themeTypes.flatMap(theme => basePaths.map(basePath => `${basePath}/${color}/${theme}.css`))
).filter(fs.existsSync);
Copy link
Member

@damyanpetev damyanpetev Apr 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, nope :)

If the idea is to build out functionality to copy all themes in general, just copy them all - at best what you can do is hardcode the path, not the specific variants (material, etc, those can and will change).

Should be fine to just copy the entire node_modules/igniteui-webcomponents-grids theme folder and it'd do the same thing as this, right? Surely the static copy plugin can work with globs
Also, not sure why restricted to igniteui-webcomponents-grids as well, should include igniteui-webcomponents's themes too, no?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also we generally keep the package licensed maps separately so this could also work with one version of the packages and swap the node_modules path with the upgrade command. We don't put path maps in tsconfig for dual package support, so that will make it somewhat consistent.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes are no longer needed, we will include these css files by importing them not by link tag.

viteStaticCopy({
targets: [
{ src: 'src/assets', dest: 'src' },
{ src: 'ig-theme.css', dest: '' },
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand why css from packages needs a static copy, but why the ig-theme which is part of the source. Is that the way vite instructs css to be handled, because I think this can also just be imported tp get it included.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wait.. that's not even it the project files? :O

Is that part for the CodeGen? Not sure it even belongs here if so, though you can argue it's functionality to allow to set global styling for all views; hint: the current styles.css is useless for that and your img, video styles and whatever missing resets we apply in other projects that are missing won't work from that either.

To that end, ig-theme can and should be in the templates with a comment explaining it sets up styles for all the views. The name also shouldn't really be ig-theme (that file actually had a different purpose initially) and should be included in all views generated by the CLI ofc.
Then you can justify the file handling in the project ;D

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, ig-theme will be renamed and included in the templates folder by CodeGen

@damyanpetev
Copy link
Member

damyanpetev commented Apr 4, 2025

Also, has someone looked for some lit-specific plugins for vite that might do something similar? Assuming this is all because links in the lit markup, so perhaps there's a plugin that can let vite read and handle those or possibly through the view component styles via @import. If so that's be cleaner than any manual process we do.

Edit: https://www.npmjs.com/package/rollup-plugin-lit-css looks interesting

@Lipata Lipata merged commit 95018f9 into master Apr 11, 2025
4 checks passed
@Lipata Lipata deleted the hhristov/update-vite-config-to-add-static-css-files branch April 11, 2025 15:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants